﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using TiledLib;

namespace MvdDonk.Bomberman
{
    static class Utils
    {
        public static Vector2 TileIndexToWorldVector(Point point, Map map)
        {
            return new Vector2(map.TileWidth * point.X, map.TileHeight * point.Y);
        }

        public static string GetProperty(this Tile tile, string propertyName)
        {
            var property = tile.Properties.FirstOrDefault(p => p.Name == propertyName);
            return property.RawValue;
        }

        public static bool PropertyIsTrue(this Tile tile, string propertyName)
        {
            return string.Compare(tile.GetProperty(propertyName), "true", true) == 0;
        }

        public static bool PropertyIsFalse(this Tile tile, string propertyName)
        {
            return string.Compare(tile.GetProperty(propertyName), "false", true) == 0;
        }
    }
}
